package com.ss.android.update;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;

import com.ss.android.common.lib.MobClickCombiner;

import java.io.File;

final class n implements DialogInterface.OnClickListener {
    private final UpdateHelper mUpdateHelper;
    private final String a;
    private final Context mContext;
    private final String c;

    n(UpdateHelper updateHelper, String arg2, Context context, String arg4) {
        this.mUpdateHelper = updateHelper;
        this.a = arg2;
        this.mContext = context;
        this.c = arg4;

    }

    public final void onClick(DialogInterface dialogInterface, int which) {
        if(this.mUpdateHelper.i()) {
            this.mUpdateHelper.b();
            if(this.a != null) {
                MobClickCombiner.onEvent(this.mContext, this.a, this.c);
            }

            File file = this.mUpdateHelper.r();
            if(file != null) {
                this.mUpdateHelper.c();
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
                this.mContext.startActivity(intent);
                return;
            }

            this.mUpdateHelper.t();
        }
    }
}

